package action.user;

import org.apache.struts2.ServletActionContext;

import service.UserService;
import bean.User;

import com.opensymphony.xwork2.ActionSupport;

public class ViewUserAction extends ActionSupport {
	private User user;
	private UserService userService;
	
	@Override
	public String execute() throws Exception {
		user=userService.viewUserById(user.getId());
		if(user==null)
			return INPUT;
		ServletActionContext.getRequest().setAttribute("user", user);
		return SUCCESS;
	}

	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}

	public UserService getUserService() {
		return userService;
	}

	public void setUserService(UserService userService) {
		this.userService = userService;
	}
	
	
}
